package de.duester.vectordrawing.object;

import android.graphics.PointF;

/**
 * @author Maxim Duester
 */
public class Rectangle extends Polygon {

	/**
	 * 
	 */
	public Rectangle() {
	}

	/**
	 * @param p
	 * @param width
	 * @param height
	 */
	public Rectangle(PointF p, float width, float height) {
		super(getRectangleCoordinates(p, width, height));
	}

	private static PointF[] getRectangleCoordinates(PointF p, float width, float height) {
		PointF[] pts = new PointF[4];
		pts[0] = p;
		pts[1] = new PointF(p.x + width - 1, p.y);
		pts[2] = new PointF(p.x + width - 1, p.y + height - 1);
		pts[3] = new PointF(p.x, p.y + height - 1);
		return pts;
	}
}
